function e = errorFunction( X, wf, b )
    X = horzcat(ones(length(X(:,1)),1)*-1, X);  % Agrego umbral a los patrones

    %errori = g_function(X*wf) - b; Original
    
    acum = 0;
    for t = 1:length(X(:,1))
        errori = b(t) - g_function(X(t,:)*wf);
        acum = acum + errori*errori;
    end
    
    e = acum/2;
end

